
import com.chilkatsoft.*;

public class Pop3 {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  private String from;
  private String Subject;
  private String Mesaj;
  public String Mesaj1;
  private int numberOfMsg;
  
  public Pop3(int nrMesaj)
  {
    //  The mailman object is used for receiving (POP3)
    //  and sending (SMTP) email.
    CkMailMan mailman = new CkMailMan();

    mailman.UnlockComponent("anything");
    //  Set the POP3 server's hostname
    mailman.put_MailHost("pop.gmail.com");

    //  Set the POP3 login/password.
    mailman.put_PopUsername("orikare@gmail.com");
    mailman.put_PopPassword("orikare1989");

    //  Indicate that we want TLS/SSL.  Also, set the port to 995:
    mailman.put_MailPort(995);
    mailman.put_PopSsl(true);

    
    CkEmailBundle bundle;
    //  Read mail headers and one line of the body.
    bundle = mailman.CopyMail();

    if (bundle == null ) {
        System.out.println(mailman.lastErrorText());
        return;
    }

    
    CkEmail email;
  
    email = bundle.GetEmail(nrMesaj);

    //  Display the From email address and the subject.
    from=email.ck_from();
    Subject=email.subject();
    Mesaj=email.getHtmlBody();
    Mesaj1=email.body();
    numberOfMsg=bundle.get_MessageCount();
  

  }
  
  
  public String emailFrom(){
	  return from;
  }
  
  public String emailSubject(){
	  return Subject;
  }
  public String emailMesaj(){
	  return Mesaj;
  }
  public int NumberOfMsg(){
	  return numberOfMsg;
  }
  public String emailMsg1(){
	  return Mesaj1;
  }
 
 
 
 
}